<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
    <title>添加提醒 - 家庭药品管理</title>
    <script src="https://cdn.tailwindcss.com"></script>
    <link href="https://cdn.jsdelivr.net/npm/font-awesome@4.7.0/css/font-awesome.min.css" rel="stylesheet">
    <link rel="stylesheet" href="css/common.css">
    <script>
        tailwind.config = {
            theme: {
                extend: {
                    colors: {
                        primary: '#16a34a',
                        secondary: '#4ade80',
                        dark: '#1e293b',
                        light: '#f8fafc'
                    }
                }
            }
        }
    </script>
    <style>
        /* iPhone 15 模拟外壳样式 */
        .iphone-frame {
            width: 390px;
            height: 844px;
            border-radius: 44px;
            background-color: #000;
            margin: 20px auto;
            position: relative;
            overflow: hidden;
            box-shadow: 0 0 0 10px #111, 0 0 0 11px #333, 0 20px 50px rgba(0, 0, 0, 0.3);
        }
        
        /* 顶部刘海区域 */
        .iphone-notch {
            position: absolute;
            top: 0;
            left: 50%;
            transform: translateX(-50%);
            width: 200px;
            height: 30px;
            background-color: #000;
            border-radius: 0 0 20px 20px;
            z-index: 10;
        }
        
        /* 底部安全区域 */
        .iphone-home-indicator {
            position: absolute;
            bottom: 8px;
            left: 50%;
            transform: translateX(-50%);
            width: 120px;
            height: 5px;
            background-color: rgba(255, 255, 255, 0.6);
            border-radius: 5px;
            z-index: 10;
        }
        
        /* 顶部状态栏 */
        .iphone-status-bar {
            height: 50px;
            background-color: #fff;
            padding-top: 15px;
            padding-left: 20px;
            padding-right: 20px;
            display: flex;
            justify-content: space-between;
            align-items: center;
            font-size: 14px;
            font-weight: 600;
        }
        
        /* 内容区域 */
        .iphone-content {
            height: calc(100% - 50px - 83px);
            background-color: #f8fafc;
            overflow-y: auto;
            -webkit-overflow-scrolling: touch;
            padding: 20px;
        }
        
        /* 底部导航栏 */
        .iphone-nav {
            height: 83px;
            background-color: white;
            border-top: 1px solid #e5e7eb;
            display: flex;
            justify-content: space-around;
            align-items: center;
            position: absolute;
            bottom: 0;
            width: 100%;
        }
        
        /* 导航项样式 */
        .nav-item {
            display: flex;
            flex-direction: column;
            align-items: center;
            justify-content: center;
            color: #9ca3af;
            text-decoration: none;
            font-size: 12px;
        }
        
        .nav-item.active {
            color: #16a34a;
        }
        
        .nav-item i {
            font-size: 22px;
            margin-bottom: 5px;
        }
        
        /* 页面头部样式 */
        .page-header {
            display: flex;
            justify-content: space-between;
            align-items: center;
            margin-bottom: 20px;
        }
        
        .page-header h1 {
            font-size: 18px;
            font-weight: 600;
            color: #1e293b;
        }
        
        /* 表单样式 */
        .form-container {
            background-color: white;
            border-radius: 12px;
            padding: 20px;
            box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
            margin-bottom: 20px;
        }
        
        .form-group {
            margin-bottom: 20px;
        }
        
        .form-label {
            display: block;
            font-weight: 500;
            color: #1e293b;
            margin-bottom: 8px;
            font-size: 15px;
        }
        
        .form-input,
        .form-select,
        .form-textarea {
            width: 100%;
            padding: 12px 16px;
            border: 1px solid #e2e8f0;
            border-radius: 8px;
            font-size: 15px;
            color: #1e293b;
            background-color: #f8fafc;
            transition: all 0.2s ease;
        }
        
        .form-input:focus,
        .form-select:focus,
        .form-textarea:focus {
            outline: none;
            border-color: #16a34a;
            box-shadow: 0 0 0 3px rgba(22, 163, 74, 0.1);
            background-color: white;
        }
        
        .form-textarea {
            min-height: 100px;
            resize: vertical;
        }
        
        /* 按钮样式 */
        .btn {
            display: inline-block;
            padding: 12px 24px;
            border-radius: 8px;
            font-weight: 600;
            text-align: center;
            cursor: pointer;
            transition: all 0.2s ease;
            text-decoration: none;
            border: none;
            font-size: 15px;
        }
        
        .btn-primary {
            background-color: #16a34a;
            color: white;
        }
        
        .btn-primary:hover {
            background-color: #15803d;
        }
        
        .btn-primary:active {
            transform: scale(0.98);
        }
        
        .btn-block {
            display: block;
            width: 100%;
        }
        
        /* 时间选择器样式 */
        .time-inputs {
            display: flex;
            gap: 10px;
        }
        
        .time-inputs input {
            flex: 1;
            text-align: center;
        }
        
        /* 重复选项样式 */
        .repeat-options {
            display: flex;
            flex-wrap: wrap;
            gap: 10px;
            margin-top: 8px;
        }
        
        .repeat-option {
            flex: 1;
            min-width: 70px;
            padding: 10px;
            background-color: #f1f5f9;
            border-radius: 8px;
            text-align: center;
            cursor: pointer;
            transition: all 0.2s ease;
            font-weight: 500;
            font-size: 14px;
        }
        
        .repeat-option.selected {
            background-color: #16a34a;
            color: white;
        }
        
        /* 提醒类型样式 */
        .reminder-type {
            display: flex;
            gap: 10px;
            margin-top: 8px;
        }
        
        .type-option {
            flex: 1;
            padding: 12px;
            border: 1px solid #e2e8f0;
            border-radius: 8px;
            text-align: center;
            cursor: pointer;
            transition: all 0.2s ease;
        }
        
        .type-option.selected {
            border-color: #16a34a;
            background-color: rgba(22, 163, 74, 0.05);
        }
        
        .type-icon {
            font-size: 24px;
            margin-bottom: 6px;
        }
        
        .type-option.selected .type-icon {
            color: #16a34a;
        }
        
        /* 药品选择样式 */
        .medicine-item {
            display: flex;
            align-items: center;
            padding: 12px;
            border: 1px solid #e2e8f0;
            border-radius: 8px;
            margin-bottom: 10px;
            cursor: pointer;
            transition: all 0.2s ease;
        }
        
        .medicine-item.selected {
            border-color: #16a34a;
            background-color: rgba(22, 163, 74, 0.05);
        }
        
        .medicine-check {
            margin-right: 12px;
            width: 20px;
            height: 20px;
            border-radius: 50%;
            border: 2px solid #e2e8f0;
            display: flex;
            align-items: center;
            justify-content: center;
        }
        
        .medicine-item.selected .medicine-check {
            background-color: #16a34a;
            border-color: #16a34a;
        }
        
        .medicine-check i {
            color: white;
            font-size: 12px;
            display: none;
        }
        
        .medicine-item.selected .medicine-check i {
            display: block;
        }
        
        .medicine-info h3 {
            font-weight: 500;
            color: #1e293b;
        }
        
        .medicine-info p {
            font-size: 13px;
            color: #64748b;
            margin-top: 2px;
        }
    </style>
</head>
<body>
    <div class="iphone-frame">
        <!-- 顶部刘海 -->
        <div class="iphone-notch"></div>
        
        <!-- 状态栏 -->
        <div class="iphone-status-bar">
            <div>9:41</div>
            <div class="flex space-x-2">
                <i class="fa fa-signal"></i>
                <i class="fa fa-wifi"></i>
                <i class="fa fa-battery-full"></i>
            </div>
        </div>
        
        <!-- 内容区域 -->
        <div class="iphone-content">
            <!-- 页面头部 -->
            <div class="page-header">
                <div class="flex items-center">
                    <button class="mr-4 w-8 h-8 flex items-center justify-center" id="backButton">
                        <i class="fa fa-arrow-left text-gray-600"></i>
                    </button>
                    <h1>添加提醒</h1>
                </div>
                <button id="saveButton" class="text-primary font-semibold">保存</button>
            </div>

            <!-- 提醒类型选择 -->
            <div class="form-container">
                <div class="form-group">
                    <label class="form-label">提醒类型</label>
                    <div class="reminder-type">
                        <div class="type-option selected">
                            <div class="type-icon"><i class="fa fa-pills"></i></div>
                            <div>用药提醒</div>
                        </div>
                        <div class="type-option">
                            <div class="type-icon"><i class="fa fa-calendar-plus-o"></i></div>
                            <div>健康检查</div>
                        </div>
                        <div class="type-option">
                            <div class="type-icon"><i class="fa fa-bell"></i></div>
                            <div>自定义</div>
                        </div>
                    </div>
                </div>
            </div>

            <!-- 用药信息 -->
            <div class="form-container">
                <div class="form-group">
                    <label class="form-label">选择药品</label>
                    <div class="medicine-item selected">
                        <div class="medicine-check"><i class="fa fa-check"></i></div>
                        <div class="medicine-info">
                            <h3>阿司匹林</h3>
                            <p>100mg × 30片</p>
                        </div>
                    </div>
                    <div class="medicine-item">
                        <div class="medicine-check"><i class="fa fa-check"></i></div>
                        <div class="medicine-info">
                            <h3>布洛芬缓释胶囊</h3>
                            <p>300mg × 20粒</p>
                        </div>
                    </div>
                    <button class="w-full py-2 text-primary font-medium flex items-center justify-center">
                        <i class="fa fa-plus-circle mr-2"></i>添加药品
                    </button>
                </div>

                <div class="form-group">
                    <label class="form-label">用药剂量</label>
                    <div class="flex">
                        <input type="number" class="form-input" placeholder="输入剂量" value="1">
                        <select class="form-select ml-2" style="width: auto;">
                            <option value="片">片</option>
                            <option value="粒">粒</option>
                            <option value="毫升">毫升</option>
                            <option value="毫克">毫克</option>
                        </select>
                    </div>
                </div>

                <div class="form-group">
                    <label class="form-label">用药频率</label>
                    <select class="form-select">
                        <option value="每天">每天</option>
                        <option value="每两天">每两天</option>
                        <option value="每周">每周</option>
                        <option value="每月">每月</option>
                    </select>
                </div>

                <div class="form-group">
                    <label class="form-label">用药时间</label>
                    <div class="grid grid-cols-2 gap-3">
                        <div class="time-inputs">
                            <input type="number" class="form-input" placeholder="时" value="8" min="0" max="23">
                            <input type="number" class="form-input" placeholder="分" value="00" min="0" max="59">
                        </div>
                        <div class="time-inputs">
                            <input type="number" class="form-input" placeholder="时" value="20" min="0" max="23">
                            <input type="number" class="form-input" placeholder="分" value="00" min="0" max="59">
                        </div>
                    </div>
                    <button class="w-full py-2 text-primary font-medium flex items-center justify-center mt-2">
                        <i class="fa fa-plus-circle mr-2"></i>添加时间
                    </button>
                </div>

                <div class="form-group">
                    <label class="form-label">重复选项</label>
                    <div class="repeat-options">
                        <div class="repeat-option">周一</div>
                        <div class="repeat-option">周二</div>
                        <div class="repeat-option">周三</div>
                        <div class="repeat-option">周四</div>
                        <div class="repeat-option">周五</div>
                        <div class="repeat-option">周六</div>
                        <div class="repeat-option">周日</div>
                    </div>
                </div>

                <div class="form-group">
                    <label class="form-label">提醒开始日期</label>
                    <input type="date" class="form-input">
                </div>

                <div class="form-group">
                    <label class="form-label">提醒结束日期</label>
                    <div class="flex items-center">
                        <input type="date" class="form-input">
                        <label class="ml-3 flex items-center cursor-pointer">
                            <input type="checkbox" class="mr-2">
                            <span>长期有效</span>
                        </label>
                    </div>
                </div>

                <div class="form-group">
                    <label class="form-label">提醒备注</label>
                    <textarea class="form-textarea" placeholder="添加备注信息..."></textarea>
                </div>
            </div>

            <!-- 底部按钮 -->
            <button class="btn btn-primary btn-block mb-6">
                创建提醒
            </button>
        </div>
        
        <!-- 底部导航栏 -->
        <div class="iphone-nav">
            <a href="index.html" class="nav-item">
                <i class="fa fa-home"></i>
                <span>首页</span>
            </a>
            <a href="medicine_management.html" class="nav-item">
                <i class="fa fa-medkit"></i>
                <span>药品</span>
            </a>
            <a href="add_medicine.html" class="nav-item">
                <i class="fa fa-plus"></i>
                <span>添加</span>
            </a>
            <a href="reminder.html" class="nav-item active">
                <i class="fa fa-bell"></i>
                <span>提醒</span>
            </a>
            <a href="profile.html" class="nav-item">
                <i class="fa fa-user"></i>
                <span>我的</span>
            </a>
        </div>
        
        <!-- 底部安全指示器 -->
        <div class="iphone-home-indicator"></div>
    </div>

    <script>
        // 返回按钮点击事件
        document.getElementById('backButton').addEventListener('click', function() {
            window.history.back();
        });

        // 保存按钮点击事件
        document.getElementById('saveButton').addEventListener('click', function() {
            console.log('用户点击了保存按钮');
            saveReminder();
        });

        // 创建提醒按钮点击事件
        document.querySelector('.btn-primary').addEventListener('click', function() {
            console.log('用户点击了创建提醒按钮');
            saveReminder();
        });

        // 提醒类型选择
        const typeOptions = document.querySelectorAll('.type-option');
        typeOptions.forEach(option => {
            option.addEventListener('click', function() {
                // 移除其他选项的选中状态
                typeOptions.forEach(opt => opt.classList.remove('selected'));
                // 添加当前选项的选中状态
                this.classList.add('selected');
                
                // 这里可以根据选择的类型显示/隐藏不同的表单字段
                console.log('用户选择了提醒类型:', this.querySelector('div:nth-child(2)').textContent);
            });
        });

        // 药品选择
        const medicineItems = document.querySelectorAll('.medicine-item');
        medicineItems.forEach(item => {
            item.addEventListener('click', function() {
                this.classList.toggle('selected');
                console.log('用户选择了药品:', this.querySelector('.medicine-info h3').textContent);
            });
        });

        // 重复选项选择
        const repeatOptions = document.querySelectorAll('.repeat-option');
        repeatOptions.forEach(option => {
            option.addEventListener('click', function() {
                this.classList.toggle('selected');
                console.log('用户选择了重复选项:', this.textContent);
            });
        });

        // 长期有效复选框
        const longTermCheckbox = document.querySelector('input[type="checkbox"]');
        const endDateInput = document.querySelector('input[type="date"]:last-of-type');
        
        longTermCheckbox.addEventListener('change', function() {
            endDateInput.disabled = this.checked;
            if (this.checked) {
                endDateInput.style.opacity = '0.5';
            } else {
                endDateInput.style.opacity = '1';
            }
        });

        // 添加药品按钮
        document.querySelector('.w-full.py-2.text-primary').addEventListener('click', function() {
            console.log('用户点击了添加药品按钮');
            alert('跳转到药品选择页面...');
        });

        // 添加时间按钮
        document.querySelector('.w-full.py-2.text-primary.mt-2').addEventListener('click', function() {
            console.log('用户点击了添加时间按钮');
            alert('添加新的用药时间...');
        });

        // 保存提醒函数
        function saveReminder() {
            // 在实际应用中，这里会收集表单数据并发送到服务器
            console.log('保存提醒信息');
            
            // 模拟保存成功
            setTimeout(() => {
                alert('提醒创建成功！');
                window.location.href = 'reminder.html';
            }, 500);
        }
    </script>
</body>
</html>